#!/bin/sh

cd tests/

# known good tests
TESTS="\
./s2n_aes_sha_composite_test \
./s2n_aes_test \
./s2n_alerts_test \
./s2n_array_test \
./s2n_change_cipher_spec_test \
./s2n_choose_supported_group_test \
./s2n_cipher_info_test \
./s2n_cipher_suites_test \
./s2n_cleanup_test \
./s2n_client_alpn_extension_test \
./s2n_client_cert_request_context_test \
./s2n_client_early_data_indication_test \
./s2n_client_empty_cert_test \
./s2n_client_finished_test \
./s2n_client_key_share_extension_test \
./s2n_client_max_frag_len_extension_test \
./s2n_client_record_version_test \
./s2n_client_sct_list_extension_test \
./s2n_client_secure_renegotiation_test \
./s2n_client_server_name_extension_test \
./s2n_client_supported_groups_extension_test \
./s2n_connection_context_test \
./s2n_connection_preferences_test \
./s2n_drbg_test \
./s2n_early_data_io_api_test \
./s2n_ecc_point_format_extension_test \
./s2n_ecc_preferences_test \
./s2n_ems_extension_test \
./s2n_error_lookup_test \
./s2n_error_type_test \
./s2n_evp_signing_test \
./s2n_extension_list_parse_test \
./s2n_extension_list_process_test \
./s2n_extension_list_send_test \
./s2n_extension_type_lists_test \
./s2n_fork_generation_number_test \
./s2n_fragmentation_coalescing_test \
./s2n_handshake_errno_test \
./s2n_handshake_hashes_test \
./s2n_handshake_invariant_test \
./s2n_handshake_io_async_test \
./s2n_handshake_io_early_data_test \
./s2n_handshake_io_errors_test \
./s2n_handshake_io_test \
./s2n_handshake_misc_test \
./s2n_handshake_type_test \
./s2n_hash_all_algs_test \
./s2n_hash_test \
./s2n_hkdf_test \
./s2n_hmac_test \
./s2n_init_test \
./s2n_kem_preferences_test \
./s2n_kex_test \
./s2n_key_share_extension_test \
./s2n_key_update_test \
./s2n_locking_test \
./s2n_malformed_handshake_test \
./s2n_map_test \
./s2n_next_protocol_test \
./s2n_npn_extension_test \
./s2n_nst_early_data_indication_test \
./s2n_post_handshake_test \
./s2n_protocol_preferences_test \
./s2n_psk_key_exchange_modes_extension_test \
./s2n_quic_transport_params_extension_test \
./s2n_random_test \
./s2n_rc4_test \
./s2n_record_size_test \
./s2n_record_test \
./s2n_record_write_test \
./s2n_rfc5952_test \
./s2n_safety_blinding_test \
./s2n_safety_macros_test \
./s2n_safety_test \
./s2n_send_multirecord_test \
./s2n_sequence_number_test \
./s2n_server_alpn_extension_test \
./s2n_server_cert_request_test \
./s2n_server_early_data_indication_test \
./s2n_server_finished_test \
./s2n_server_max_frag_len_extension_test \
./s2n_server_psk_extension_test \
./s2n_server_server_name_extension_test \
./s2n_server_session_ticket_extension_test \
./s2n_server_signature_algorithms_extension_test \
./s2n_server_supported_versions_extension_test \
./s2n_shutdown_test \
./s2n_ssl_prf_test \
./s2n_stream_cipher_null_test \
./s2n_stuffer_base64_test \
./s2n_stuffer_hex_test \
./s2n_stuffer_network_order_test \
./s2n_stuffer_text_test \
./s2n_testlib_test \
./s2n_timer_test \
./s2n_tls12_handshake_test \
./s2n_tls13_cert_request_extensions_test \
./s2n_tls13_cert_request_test \
./s2n_tls13_client_finished_test \
./s2n_tls13_handshake_state_machine_test \
./s2n_tls13_key_schedule_rfc8448_test \
./s2n_tls13_key_schedule_test \
./s2n_tls13_keys_test \
./s2n_tls13_parse_record_type_test \
./s2n_tls13_prf_test \
./s2n_tls13_record_aead_test \
./s2n_tls13_secrets_rfc8448_test \
./s2n_tls13_secrets_test \
./s2n_tls13_server_finished_test \
./s2n_tls13_support_test \
./s2n_tls13_zero_length_payload_test \
./s2n_tls_record_stuffer_test \
./s2n_utils_test \
./s2n_wildcard_hostname_test \
./s2n_ecc_evp_test \
./s2n_tls13_server_cert_test \
./s2n_tls13_hybrid_shared_secret_test \
./s2n_tls13_handshake_early_data_test \
./s2n_stuffer_test \
./s2n_resume_test \
./s2n_quic_support_io_test \
./s2n_quic_support_test \
./s2n_psk_test \
./s2n_psk_offered_test \
./s2n_pq_kem_test \
./s2n_kem_test \
./s2n_extensions_server_key_share_select_test \
./s2n_early_data_test \
./s2n_client_session_ticket_extension_test \
./s2n_client_key_share_extension_pq_test \
./s2n_blob_test \
./s2n_3des_test \
./s2n_async_pkey_test \
./s2n_auth_selection_test \
./s2n_cert_chain_and_key_test \
./s2n_certificate_extensions_test \
./s2n_certificate_test \
./s2n_cipher_suite_match_test \
./s2n_client_auth_handshake_test \
./s2n_client_cert_verify_test \
./s2n_client_extensions_test \
./s2n_client_hello_recv_test \
./s2n_client_hello_request_test \
./s2n_client_hello_retry_test \
./s2n_client_hello_test \
./s2n_client_psk_extension_test \
./s2n_client_renegotiation_info_extension_test \
./s2n_client_signature_algorithms_extension_test \
./s2n_client_supported_versions_extension_test \
./s2n_config_test \
./s2n_connection_test \
./s2n_cookie_test \
./s2n_crl_test \
./s2n_drain_alert_test \
./s2n_early_data_io_test \
./s2n_ecdsa_test \
./s2n_encrypted_extensions_test \
./s2n_extended_master_secret_test \
./s2n_extension_type_test \
./s2n_handshake_partial_test \
./s2n_handshake_test \
./s2n_mem_allocator_test \
./s2n_mem_test \
./s2n_mem_usage_test \
./s2n_mutual_auth_test \
./s2n_optional_client_auth_test \
./s2n_override_openssl_random_test \
./s2n_pem_rsa_dhe_test \
./s2n_pem_test \
./s2n_pkey_test \
./s2n_post_handshake_recv_test \
./s2n_recv_test \
./s2n_release_non_empty_buffers_test \
./s2n_renegotiate_io_test \
./s2n_renegotiate_test \
./s2n_rsa_pss_rsae_test \
./s2n_rsa_pss_test \
./s2n_security_policies_test \
./s2n_self_talk_alerts_test \
./s2n_self_talk_alpn_test \
./s2n_self_talk_broken_pipe_test \
./s2n_self_talk_client_hello_cb_test \
./s2n_self_talk_custom_io_test \
./s2n_self_talk_io_mem_test \
./s2n_self_talk_key_log_test \
./s2n_self_talk_min_protocol_version_test \
./s2n_self_talk_nonblocking_test \
./s2n_self_talk_npn_test \
./s2n_self_talk_offload_signing_test \
./s2n_self_talk_psk_test \
./s2n_self_talk_quic_support_test \
./s2n_self_talk_session_id_test \
./s2n_self_talk_session_resumption_test \
./s2n_self_talk_shutdown_test \
./s2n_self_talk_tls12_test \
./s2n_self_talk_tls13_test \
./s2n_send_key_update_test \
./s2n_server_extensions_test \
./s2n_server_hello_retry_test \
./s2n_server_hello_test \
./s2n_server_key_share_extension_test \
./s2n_server_new_session_ticket_test \
./s2n_server_renegotiation_info_test \
./s2n_server_sct_list_extension_test \
./s2n_signature_algorithms_test \
./s2n_tls13_cert_verify_test \
./s2n_tls13_compute_shared_secret_test \
./s2n_tls13_handshake_test \
./s2n_tls13_new_session_ticket_test \
./s2n_tls13_pq_handshake_test \
./s2n_tls_prf_test \
./s2n_x509_validator_certificate_signatures_test \
./s2n_x509_validator_test \
"

for TEST in $TESTS
do
    S2N_PRINT_STACKTRACE=1 $TEST
    RETVAL=$?
    if [ $RETVAL -eq 0 ] ; then
        echo -e "\nPASS: s2n unittest: $TEST\n"
    else
        echo -e "\nFAIL: s2n unittest: $TEST\n"
    fi
done
